package com.slz3.business.module.goodsManagement.gooBaseGoodsSpecificationValue.service;

import com.slz3.business.frame.module.Repositorys;
import com.slz3.business.module.goodsManagement.gooBaseGoodsSpecificationValue.domain.GooBaseGoodsSpecificationValue;
import com.slz3.business.module.goodsManagement.gooBaseGoodsSpecificationValue.domain.GooBaseGoodsSpecificationValueFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Slf4j
@Service
public class GooBaseGoodsSpecificationValueTransactionalServiceImpl implements GooBaseGoodsSpecificationValueTransactionalService {

    @Override
    public GooBaseGoodsSpecificationValue modify(GooBaseGoodsSpecificationValue gooBaseGoodsSpecificationValueNew) {
        Repositorys.gooBaseGoodsSpecificationValue.test();
        Repositorys.gooBaseGoodsSpecificationValue.save(GooBaseGoodsSpecificationValueFactory.initBaseFields());
        System.err.println(1/0);
        gooBaseGoodsSpecificationValueNew.setLastModifyTime(LocalDateTime.now());
        return Repositorys.gooBaseGoodsSpecificationValue.saveAndFlush(gooBaseGoodsSpecificationValueNew);
    }

    @Override
    public List<GooBaseGoodsSpecificationValue> batchModify(List<GooBaseGoodsSpecificationValue> gooBaseGoodsSpecificationValueList) {
        return Repositorys.gooBaseGoodsSpecificationValue.saveAll(gooBaseGoodsSpecificationValueList);
    }
}
